//
//  main.swift
//  LeetCode
//
//  Created by 刘彬彬 on 2020/6/22.
//  Copyright © 2020 LBB. All rights reserved.
//

import Foundation
//var stockJobbing = Stock()
////let input = readLine()
//print(stockJobbing.maxProfit([5,3,7,1,4]))
//
//var tree = Tree()
//
//var treeModel3 = TreeNode(3,Optional.none,Optional.none)
//var treeModel4 = TreeNode(4,Optional.none,Optional.none)
//var treeModel5 = TreeNode(5,Optional.none,Optional.none)
//var treeModel2 = TreeNode(2,treeModel4,treeModel5)//TreeNode(2,Optional.none,treeModel5)
//var treeModel1 = TreeNode(1,treeModel2,treeModel3)//TreeNode(1,treeModel2,Optional.none)
//
//print("depth=",tree.diameterOfBinaryTree(treeModel1))

//var commonFactor = CommonFactor()
//print(commonFactor.solution("ABCD","EFGH"))
//print(commonFactor.solution("AAAA","AA"))
//print(commonFactor.solution("AAA","AA"))
//print(commonFactor.solution("ABAB","ABAB"))
//print(commonFactor.solution("ABABAB","ABAB"))
//print(commonFactor.solution("TAUXXTAUXXTAUXXTAUXXTAUXX","TAUXXTAUXXTAUXXTAUXXTAUXXTAUXXTAUXXTAUXXTAUXX"))
//print(commonFactor.solution("TAUXXTAUXXTAUXXTAUXXTAUXX","TAUXXTAUXXTAUXXTAUXXTAUXXTAUXXTAUXXTAUXXTAUXXTAUXX"))
//print(commonFactor.solution("OBCNOOBCNOOBCNOOBCNOOBCNOOBCNOOBCNOOBCNO","OBCNOOBCNOOBCNOOBCNOOBCNOOBCNOOBCNOOBCNOOBCNOOBCNOOBCNOOBCNOOBCNO"))

//var comPress = Compress()
//print(comPress.solution("aabbccddefg"))
//print(comPress.solution("aabcccccaa"))

//var wordCombination = WordCombination()
//print("长度 = ",wordCombination.countCharacters(["hello","world","leetcode"], "welldonehoneyr"))

//var keysAndRooms = KeysAndRooms()
//print(keysAndRooms.canVisitAllRooms([]))

//var off = FindRepeatNumber()
//print(off.findRepeatNumber([2, 3, 1, 0, 2, 5, 3]))

//var four = FindNumberIn2DArray()
//print(four.findNumberIn2DArray([
//  [1,   4,  7, 11, 15],
//  [2,   5,  8, 12, 19],
//  [3,   6,  9, 16, 22],
//  [10, 13, 14, 17, 24],
//  [18, 21, 23, 26, 30]
//], 20))

//var temp = ReplaceSpace ()
//print(temp.replaceSpace("We are happy."))

//var offer_06 = Offer_06 ()
//var listNode1 = ListNode(1)
//var listNode2 = ListNode(2)
//var listNode3 = ListNode(3)
//listNode1.next = listNode3
//listNode3.next = listNode2
//print(offer_06.reversePrint(listNode1))

//var offer_07 = Offer_07 ()
//print(offer_07.buildTree([3,9,20,15,7], [9,3,15,20,7]))

//["CQueue","appendTail","deleteHead","deleteHead"]
//let offer_09 = CQueue()
//offer_09.appendTail(3)
//offer_09.appendTail(2)
//let ret_2: Int = offer_09.deleteHead()
//let ret_3: Int = offer_09.deleteHead()
//print(ret_2)

//let offer_10 = Fibonacci01()
//print(offer_10.fib(11))
//
//let offer_11 = Fibonacci02()
//print(offer_11.numWays(7))

//let offer_12 = Offer_12()
////print(offer_12.exist([["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], "ABCCED"))
////print(offer_12.exist([["a","b"],["c","d"]], "abcd"))
//print(offer_12.exist([["a"],["a"]], "aaa"))

//var num = 11
//num /= 10
//print(num)

//let offer_13 = Offer_13()
//print(offer_13.movingCount(3, 2, 17))  //6

//let offer_13 = Offer_13()
//print(offer_13.movingCount(3, 2, 17))  //6
//
//let one = LCOne()
//print(one.singleNumber([1,2,2,2]))

//let two = LCTwo()
//print(two.majorityElement([2,2,1,1,1,2,2]))

//let three = LCThree()
//print(three.searchMatrix([[1,4,7,11,15],[2,5,8,12,19],[3,6,9,16,22],[10,13,14,17,24],[18,21,23,26,30]], 5))

//let four = LCFour()
//var temp:[Int] = [4,5,6,0,0,0]
//print(four.merge(&temp, 3, [1,2,3], 3))

//let five = LCFive()
//print(five.superEggDrop(2,6))


//var convert = String(10,radix:2)
////convert=String(16,radix:16)
//print(convert)

let offer17 = Offer_17()
print(offer17.printNumbers(2))
